using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GodSoft.Models.Mapping
{
    public class UserInfoMap : EntityTypeConfiguration<UserInfo>
    {
        public UserInfoMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.UName)
                .IsRequired()
                .HasMaxLength(32);

            this.Property(t => t.Pwd)
                .IsRequired()
                .HasMaxLength(32);

            this.Property(t => t.Phone)
                .HasMaxLength(16);

            this.Property(t => t.Mail)
                .HasMaxLength(32);

            // Table & Column Mappings
            this.ToTable("UserInfo");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.UName).HasColumnName("UName");
            this.Property(t => t.Pwd).HasColumnName("Pwd");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.Mail).HasColumnName("Mail");
            this.Property(t => t.SubTime).HasColumnName("SubTime");
            this.Property(t => t.LastModifiedOn).HasColumnName("LastModifiedOn");
            this.Property(t => t.DelFlag).HasColumnName("DelFlag");
        }
    }
}
